#pragma once
#include <string>
#include <istream>
#include <sstream>
#include <map>
#include <vector>
struct FileInfo {
public:

	FileInfo() {}
	FileInfo(std::string fn,time_t lm, size_t sz,time_t loc) {
		this->fn = fn;
		this->lm = lm;
		this->sz = sz;
		this->loc = loc;
	}
	std::string fn;
	time_t lm;
	size_t sz;
	time_t loc;
};

typedef std::map<std::string, FileInfo> FileInfoMap;
typedef FileInfoMap::iterator FileInfoMapIterator;
typedef FileInfoMap::const_iterator FileInfoMapCIterator;

class BackupManager
{
public:
	BackupManager();
	~BackupManager();
	void backup();
	void restore(time_t t);
private:
	//void restoreFile()
	std::string createZipFileName(const time_t& cur);
	std::string getLatestBackupFile();
	std::stringstream writeFileList(const FileInfoMap& m);
	void createFileList(FileInfoMap& m,time_t cur);
	void readFileList(std::istream& s, FileInfoMap& m);
	void compareFileList(const FileInfoMap& om, FileInfoMap& nm, std::vector<std::string> &dif);
};

